package com.aiyige.page.learn.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.aiyige.R;
import com.aiyige.model.moment.entity.Moment;
import com.aiyige.page.learn.LearnDataPage;
import com.aiyige.utils.StringUtils;

import java.util.LinkedList;
import java.util.List;

/**
 * Created by zhuyakun on 2017/12/12.
 */

public class LearnViewPagerAdapter extends FragmentStatePagerAdapter {
    List<LearnDataPage> pageList = new LinkedList<>();
    List<String> pageTitleList = new LinkedList<>();

    public LearnViewPagerAdapter(FragmentManager fm) {
        super(fm);
        pageList.add(LearnDataPage.newInstance(Moment.SUBJECT_VIDEO_COURSE_INDEX));
        pageList.add(LearnDataPage.newInstance(Moment.SUBJECT_MAJOR_COURSE_INDEX));
        // pageList.add(LearnDataPage.newInstance(Moment.SUBJECT_TRAINING_COURSE_INDEX));
        //  pageList.add(LearnDataPage.newInstance(Moment.SUBJECT_TRAINING_CARD_INDEX));
        pageTitleList.add(StringUtils.getString(R.string.learn_video));
        pageTitleList.add(StringUtils.getString(R.string.major_course));
        pageTitleList.add(StringUtils.getString(R.string.training_class));
        //  pageTitleList.add(StringUtils.getString(R.string.traing_card));
    }

    @Override
    public Fragment getItem(int position) {
        return pageList.get(position);
    }

    @Override
    public int getCount() {
        return pageList.size();
    }

    public LearnDataPage getPage(int position) {
        return pageList.get(position);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return pageTitleList.get(position);
    }
}
